package cn.csdj.sism.web;

import cn.csdj.sism.pojo.Employee;
import cn.csdj.sism.pojo.ExamType;
import cn.csdj.sism.service.ExamTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
/**
 * Controller实现类
 * 谭世豪
 * 2023/4/10
 */
@CrossOrigin
@Controller
@RequestMapping("/examType")
public class ExamTypeController {
    @Autowired
    private ExamTypeService examTypeService;

    /**
     * 添加考试类型
     * @param examType
     * @return
     */
    @PostMapping
    public int Insert(@RequestBody ExamType examType){
        return examTypeService.insert(examType);
    }

    /**
     * 删除考试类型
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public int deleteById(@PathVariable Integer id) {
        return examTypeService.deleteById(id);
    }
    /**
     * 修改考试类型
     * @param examType
     * @return
     */
    @PutMapping
    public int update(@RequestBody ExamType examType){
        return examTypeService.update(examType);
    }

    /**
     * 查询考试类型
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public ExamType selectById(@PathVariable Integer id){
        return examTypeService.selectById(id);
    }
    /**
     * 查询全部考试类型
     * @return
     */
    @GetMapping
    public List<ExamType> selectAll(){
        return examTypeService.selectAll();
    }
}
